package com.colin.controller;

import com.colin.pojo.ChanPian;
import com.colin.pojo.ChanPianGongXuTimeTabile;
import com.colin.pojo.JiQi;
import com.colin.pojo.YouLian;
import com.colin.service.ChanPinService;
import com.colin.service.JiQiService;
import com.colin.service.ProductAndManchineRelationSercice;
import com.colin.service.YouLianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("web")
public class WebController {

    @Autowired
    YouLianService youLianService;
    @Autowired
    JiQiService jiQiService;
    @Autowired
    ChanPinService chanPinService;
    @Autowired
    ProductAndManchineRelationSercice productAndManchineRelationSercice;

    @RequestMapping("to")
    public String toString1 () {
       return "welcome";
    }
    @RequestMapping("one")
    public String one () {
        return "one";
    }
    @RequestMapping ("tiaoZhuan1")
    public String tiaoZhuan1 () {
        return "one";
    }

    @RequestMapping ("tiaoZhuan2")
    public String tiaoZhuan2 (HttpSession session) {
        List<JiQi> jiQiList = jiQiService.selectAll();
        int countJiQiNumber = jiQiService.count();
        session.setAttribute("jiQiList",jiQiList);
        session.setAttribute("countJiQiNumber",countJiQiNumber);
        return "two";
    }

    @RequestMapping ("tiaoZhuan3")
    public String tiaoZhuan3 ( HttpSession session) {
        int countChanPianNumber =chanPinService.count();
        List<ChanPian> chanPianList= chanPinService.selectALL();
        session.setAttribute("countChanPianNumber",countChanPianNumber);
        session.setAttribute("chanPianList",chanPianList);
        return "three";
    }

    @RequestMapping ("tiaoZhuan4")
    public String tiaoZhuan4 () {
        return "four";
    }

    @RequestMapping ("tiaoZhuan5")
    public String tiaoZhuan5 () {

        return "five";
    }

    @RequestMapping ("tiaoZhuan6")
    public String tiaoZhuan6 () {
        return "six";

    }

    @RequestMapping ("tiaoZhuan7")
    public String tiaoZhuan7 (HttpSession session)
    {
        List<YouLian> youlian = youLianService.findYouLian();
        session.setAttribute("youlian", youlian);
        return "seven";
    }

    @RequestMapping ("tiaoZhuan8")
    public String tiaoZhuan8 () {
        return "eight";
    }

    @RequestMapping ("tiaoZhuan9")
    public String tiaoZhuan9 ( HttpSession session) {
        List<ChanPianGongXuTimeTabile> listTable = productAndManchineRelationSercice.selelctAll();
        session.setAttribute("listTable", listTable);
        return "nine";
    }

}
